"""mySimpleUi URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include
from django.urls import re_path
from django.views.static import serve
from django.conf import settings
from django.urls import path
from . import views


urlpatterns = [
    path('api/admin/', admin.site.urls),
    path('api/flow_statistics/', include('flow_statistics.urls')),  # 流量统计
    # 静态文件
    re_path('api/media/(?P<path>.*)', serve, {"document_root": settings.MEDIA_ROOT}, name='media'),  # media文件模块
    re_path('api/static/(?P<path>.*)', serve, {"document_root": settings.STATIC_ROOT, 'show_indexes': True}, name='static'),  # 静态文件模块

    # template文件模块
    re_path('api/template/(?P<path>.*)', serve, {"document_root": settings.TEMPLATES[0].get('DIRS')[0]}, name='template'),     # pdfjs放在template了

    # html文件
    re_path('api/myHtml/(?P<path>.*)', views.myHtml),
]
